
var form_onBeforeLoad = function(param)
{
	jQuery(this).datagrid('options').url =__Manager_User_BuildUrl() ;
};

function __Manager_User_BuildUrl(){
	var url=__FormHelper_GetActionLink(); 
	var options=__FormHelper_GetGridObject().datagrid("options");
	url+="&page="+options.pageNumber+"&pageSize="+options.pageSize;
	return url;

}

function Manageuser_Init()
{
	alert("init done");
}
function _Manager_User_Add()
{
	var url="/index.php?module=filemanagermodule&action=manager_user_edit&src="+__FormHelper_GetSrc();
	window.location=url;
}
function _Manager_User_Edit(){

	var node = __FormHelper_GetGridObject().datagrid('getSelected');
	if (node){
		var url="/index.php?module=filemanagermodule&action=manager_user_edit&src="+__FormHelper_GetSrc()+"&id="+node.id;
		window.location=url;
	}
	// 
}

function _Manager_User_Remove(){
	var msg = "Are you sure you want to remove this user?";
	if(!confirm(msg)) return;
	var temp=Math.random()*9999;
	var node = __FormHelper_GetGridObject().datagrid('getSelected');
	if (node){
		jQuery.post("/index.php", {
			module: 'filemanagermodule',
			action: 'manager_user_remove',
			ajax_action: '1',
			id: node.id,
			t: temp
		},
		function(param)
		{
			__FormHelper_GetGridObject().datagrid('reload');
		}
		);
		__FormHelper_GetGridObject().datagrid('clearSelections');

	}
}

// handle event on select
var Manage_User_OnSelect = function(rowIndex, rowData){
	if (rowData.active == 0){ // disabled
		jQuery("#ManageUser_TB_Disable").hide();
		jQuery("#ManageUser_TB_Enable").show();
	}
	else
	{
		jQuery("#ManageUser_TB_Disable").show();
		jQuery("#ManageUser_TB_Enable").hide();
	}
}

function _Manager_User_SetState()
{
	var node = __FormHelper_GetGridObject().datagrid('getSelected');
	var temp=Math.random()*9999;
	if (node){
		jQuery.post("/index.php", {
			module: 'filemanagermodule',
			action: 'manager_user_changestate',
			ajax_action: '1',
			id: node.id,
			t: temp
		},
		function(param)
		{
			__FormHelper_GetGridObject().datagrid('reload');
		}
		);
		__FormHelper_GetGridObject().datagrid('clearSelections');
		jQuery("#ManageUser_TB_Disable").hide();
		jQuery("#ManageUser_TB_Enable").hide();

	}
}